package com.jiadeyu.validation;

import com.jiadeyu.anno.ArticleState;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class ArticleStateValidate implements ConstraintValidator<ArticleState, String> {
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context){
        if (value == null || value.trim().isEmpty()){
            return false;
        }
        return value.equals("已发布") || value.equals("草稿");
    }
}
